(function() {
    'use strict';
    /**
     * @ngdoc function
     * @name webApp.controller:ReviewCtrl
     * @description
     * # ReviewCtrl
     * Controller of the webApp
     */
    angular.module('webApp')
        .controller('ReviewCtrl', ReviewCtrl);

    ReviewCtrl.$inject = ['$scope', 'dataService', '$location', '$state', 'helper', '$rootScope', '$timeout', 'sessionService', 'cacheService', 'Upload', 'ERP_CONFIG'];

    function ReviewCtrl($scope, dataService, $location, $state, helper, $rootScope, $timeout, sessionService, cacheService, Upload, ERP_CONFIG) {
        $scope.listAction = function() {
            $scope.pageNo = 1;
            $scope.pageSize = 10;
            $scope.getReviewList();
        }

        //获取列表
        $scope.getReviewList = function(pageNo) {
            $scope.industryCode = $rootScope.industryCode;
            var query = {};

            query = {
                page_no: pageNo ? pageNo : $scope.pageNo,
                page_size: $scope.pageSize,
                query: {
                    "partner_id": sessionService.get('tokenUser').CompanyId
                }
            };

            if ($scope.order_id) {
                query.query.order_id = $scope.order_id;
            }

            $scope.reviewList = [];
            $scope.reviewTotal = 0;
            dataService.reviewGet(query).then(function(list) {
                if (list) {
                    $scope.reviewList = list.review;
                    $scope.reviewTotal = list.total_count;
                }
            });
        }
    }
})();